<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAdminUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('admin_user')) {
            Schema::create('admin_user', function (Blueprint $table) {
                $table->increments('id');
                $table->string('name', 100)->default('');
                $table->string('email', 50)->default('');
                $table->string('password', 200);
                $table->string('remember_token', 100)->default('');
                $table->integer('created_at')->default(0);
                $table->integer('updated_at')->default(0);
                $table->char('mobile', 11);
                $table->smallInteger('role_id')->default(0);
                $table->string('username', 50)->unique();
                $table->integer('last_login_time')->default(0);
                $table->tinyInteger('status')->default(1)->comment('状态 1正常,0禁用');
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_user');
    }
}
